package com.cskaoyan.controller.wx;

import com.cskaoyan.bean.vo.BaseRespVo;
import com.cskaoyan.bean.vo.CatalogIndexVo;
import com.cskaoyan.bean.vo.CurrentVo;
import com.cskaoyan.service.WXCatalogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: ycb
 * @description: 微信小程序目录
 * @time: 2021/7/12 10:16
 */

@RestController
@RequestMapping("wx/catalog")
public class CatalogController {

    @Autowired
    WXCatalogService catalogService;

    /**
     * @Author ycb
     * @description:
     * @Date 11:47 2021/7/12
     * url: http://182.92.235.201:8083/wx/catalog/index
     */
    @RequestMapping("index")
    public BaseRespVo index(){
        CatalogIndexVo catalogIndexVo = catalogService.queryCatalog();
        return BaseRespVo.ok(catalogIndexVo);
    }


    /**
     * @Author ycb
     * @description: 当前目录
     * @Date 10:16 2021/7/12
     * url: http://182.92.235.201:8083/wx/catalog/current?id=1036025
     */
    @RequestMapping("current")
    public BaseRespVo current(Integer id){
        CurrentVo currentVo = catalogService.queryCurrentCatalog(id);
        return BaseRespVo.ok(currentVo);
    }
}